# Maintainer: Simon Zeni <simon@bl4ckb0ne.ca>
pkgname=libei
pkgver=1.2.1
pkgrel=0
_munit=fbbdf1467eb0d04a6ee465def2e529e4c87f2118
pkgdesc="Emulated Input library"
url="https://gitlab.freedesktop.org/libinput/libei"
arch="all"
license="MIT"
makedepends="
	basu-dev
	libevdev-dev
	libxkbcommon-dev
	meson
	py3-attrs
	py3-jinja2
	"
checkdepends="
	libxml2-utils
	py3-dbusmock
	py3-pytest
	py3-structlog
	py3-yaml
	"
subpackages="
	$pkgname-dev
	libeis
	liboeffis
	$pkgname-utils
	"
source="https://gitlab.freedesktop.org/libinput/libei/-/archive/$pkgver/libei-$pkgver.tar.bz2
	munit-$_munit.tar.gz::https://github.com/nemequ/munit/archive/$_munit.tar.gz
	test-Raise-SIGALARM-interval-to-50.patch
	"

prepare() {
	default_prepare

	ln -sfv "$srcdir"/munit-$_munit subprojects/munit
}

build() {
	abuild-meson \
		-Db_lto=true \
		-Dliboeffis=enabled \
		-Dsd-bus-provider=basu \
		-Dtests="$(want_check && echo enabled || echo disabled)" \
		. output
	meson compile -C output
}

check() {
	meson test -t 5 --no-rebuild --print-errorlogs -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
}

libeis() {
	amove usr/lib/libeis.so.*
}

liboeffis() {
	amove usr/lib/liboeffis.so.*
}

utils() {
	amove usr/bin
}

sha512sums="
ac8e32a381b9555a6b9becab9217a323d79aeba4b3f11e1dbba9f876d566f232f41d0f299f8cb8e5de6707d0dd91e93872edd81532c971e35d1cf33f9f9063b4  libei-1.2.1.tar.bz2
26b5599fd12be627a692823ebf496fa446be7ed04a1233fb42e0667c05109b0f804f76646e289ac660fc815baf45f77ec8caf0ff2ea7fb0b4f87f0038a2b971c  munit-fbbdf1467eb0d04a6ee465def2e529e4c87f2118.tar.gz
56a0f1fb0a71a547f131d6daf4d092212b6f5d8458e122472d41196603baefa0a7c544a9d0625bf12ca8dd874c7355842b41ecad0bd968f4d4761b7b869f4890  test-Raise-SIGALARM-interval-to-50.patch
"
